//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#include <ddk.h>
#include "ddk_tst_print.h"

typedef UInt16 IO_PORT;

int tAssert(int iIn)
{
    kprintf("%d\n", iIn);
    return iIn%2;
}

class Routines : public CDeviceDriver
{
public:
    CARAPI Read(
        /* [in] */ Int64 u64Offset,
        /* [in] */ Int32 bytesToRead,
        /* [out] */ EzByteBuf buffer,
        /* [out] */ IEvent * * ppCompletionEvent);

    CARAPI Write(
        /* [in] */ Int64 u64Offset,
        /* [in] */ EzByteBuf buffer,
        /* [out] */ Int32 * pBytesWritten,
        /* [out] */ IEvent * * ppCompletionEvent);

    CARAPI Control(
        /* [in] */ Handle32 nControlCode,
        /* [in] */ EzByteBuf inBuffer,
        /* [out] */ EzByteBuf * pOutBuffer,
        /* [out] */ IEvent * * ppCompletionEvent);

    virtual void Dispose() {}

    ECode TestInOutWord(IO_PORT port, uint16_t uInData);
    ECode TestInOutLong(IO_PORT port, uint32_t uInData);
    void TestPrintEscapeSequences();
    void TestPrintX(int i);
    void TestPrintx(int i);
    void TestPrintd(int i);
    void TestPrintu(int i);
    void TestPrinto(int i);
    void TestPrintb(int i);
    void TestPrintc(char i);
    void TestPrints(char *i);
    void TestPrintS(wchar_t *i);
//    void Testi(int i);
//    void Testf(double i);
//    void TestE(double i);
//    void Teste(double i);
//    void TestG(double i);
//    void Testg(double i);
//    void TestC(wchar_t i);

    void Testnp();
};

EXTERN IDeviceDriver * CDECL CreateRoutines(uint_t uDeviceNo,
    void *pvParameter)
{
    Routines *pDriver = new Routines;
    if (NULL == pDriver) {
        kprintf("ERROR:There have no enough memory, %s, %d\n",
                        __FILE__, __LINE__);
        return NULL;
    }

    pDriver->AddRef();

    return pDriver;
}

ECode Routines::Read(
    /* [in] */ Int64 u64Offset,
    /* [in] */ Int32 bytesToRead,
    /* [out] */ EzByteBuf buffer,
    /* [out] */ IEvent * * ppCompletionEvent)
{
    return E_NOT_IMPLEMENTED;
}

ECode Routines::Write(
    /* [in] */ Int64 u64Offset,
    /* [in] */ EzByteBuf buffer,
    /* [out] */ Int32 * pBytesWritten,
    /* [out] */ IEvent * * ppCompletionEvent)
{
    return E_NOT_IMPLEMENTED;
}

ECode Routines::Control(
    /* [in] */ Handle32 nControlCode,
    /* [in] */ EzByteBuf inBuffer,
    /* [out] */ EzByteBuf * pOutBuffer,
    /* [out] */ IEvent * * ppCompletionEvent)
{
    int ret;
    IO_PORT port;
    char pszTemp[20];

    switch (nControlCode) {
        //Inb and Outb
        case 101:
            uint8_t ubOldData, ubData;
            int i;
            kprintf("Testing Inb and Outb:\n");
            port = *(IO_PORT *)(char *)inBuffer;
            ubOldData = Inb(port);
            kprintf("The old value is %02X\n", ubOldData);
            for (i = 0; i <= 0xFF; i++) {
                Outb(port, (uint8_t)i);
                ubData = Inb(port);
                kprintf("%02X ",ubData);
                if (ubData != (uint8_t)i)
                    return E_FAIL;
            }
            Outb(port, ubOldData);
            kprintf("\n");
            break;
        //Inw and Outw
        case 102:
            uint16_t uwOldData;
            kprintf("Testing Inw and Outw:\n");
            port = *(IO_PORT *)(char *)inBuffer;
            uwOldData = Inw(port);
            kprintf("The old value is %04X\n", uwOldData);
            if (FAILED(TestInOutWord(port, 0x0000)))
                return E_FAIL;
            if (FAILED(TestInOutWord(port, 0xFFFF)))
                return E_FAIL;
            if (FAILED(TestInOutWord(port, 0xB2A3)))
                return E_FAIL;
            if (FAILED(TestInOutWord(port, 0x4D5C)))
                return E_FAIL;
            Outw(port, uwOldData);
            kprintf("\n");
            break;
        //Inl and Outl
        case 103:
            uint32_t ulOldData;
            kprintf("Testing Inw and Outw:\n");
            port = *(IO_PORT *)(char *)inBuffer;
            ulOldData = Inl(port);
            kprintf("The old value is %08X\n", ulOldData);
            if (FAILED(TestInOutLong(port, 0x00000000)))
                return E_FAIL;
            if (FAILED(TestInOutLong(port, 0xFFFFFFFF)))
                return E_FAIL;
            if (FAILED(TestInOutLong(port, 0xB2A34D5C)))
                return E_FAIL;
            if (FAILED(TestInOutLong(port, 0x4D5CB2A3)))
                return E_FAIL;
            Outl(port, ulOldData);
            kprintf("\n");
            break;
        // kputs
        case 1001:
            // some characters
            ret = kputs("hello, kernel!\n");
            if (ret < 0) return ret;
            ret = kputs(" / ?Hello world! / ? \n");
            if (ret < 0) return ret;
            ret = kputs("  '~!@#$ % ^&*()_ + < >    \t\b\n' ");
            return ret;

        case 1002:
            // output 0-255
            int n;
            char szi[3];
            szi[0] = ' ';
            szi[2] = '\0';
            for (n = 0; n < 256; n++) {
                szi[1] = n;
                ret = kputs(szi);
                if (ret < 0) return ret;
            }
            return ret;

        case 1003:
            // output inBuffer
            kputs("inBuffer = ");
            ret = kputs((char *)inBuffer);
            return ret;

        case 1004:
            ret = kputs(0);
            return ret;

            // kprintf //np
        case 2000:
            DDK_PRINT_BLOCK_START("tkprintf.out");
            TestPrintEscapeSequences();
            kprintf("Test number %d,%d,%d", 1, 2, 3, 4, 5);
            kprintf("\n");
            strcpy(pszTemp, "Test string to pring number %d");
            kprintf(pszTemp, 1);
            kprintf("\n");
            TestPrintX(92345678);
            TestPrintX(0);
            TestPrintx(92345678);
            TestPrintx(0);
            TestPrintd(-9234);
            TestPrintd(115641);
            TestPrintd(0);
            TestPrintu(92345678);
            TestPrintu(0);
            TestPrinto(92345678);
            TestPrinto(0);
            TestPrintb(257);
            TestPrintb(0);
            TestPrintc('c');
            TestPrints("single-byte-character.");
            TestPrintS(L"wide-character.");
            DDK_PRINT_BLOCK_END();
            break;

        case 2001:
            int iRet1, iRet2, iRet3, iRet4;
            iRet1=kprintf("%");
            kprintf("X\n");
            iRet2=kprintf("%%");
            kprintf("X\n");
            iRet3=kprintf("%%%");
            kprintf("X\n");
            iRet4=kprintf("%%%%");
            kprintf("X\n");
            kprintf("iRet1=%d, iRet2=%d, iRet3=%d, iRet4=%d\n",
            iRet1, iRet2, iRet3, iRet4);
            break;
        case 2002:
            TestPrintEscapeSequences();
            break;
        case 2003:
            kprintf("Test number %d,%d,%d", 1, 2, 3, 4, 5);
            break;
        case 2004:
            strcpy(pszTemp, "Test string to pring number %d");
            kprintf(pszTemp, 1);
            break;
        case 2005:
            break;
        case 2006:
            TestPrintX(92345678);
            TestPrintX(0);
            break;
        case 2007:
            TestPrintx(92345678);
            TestPrintx(0);
            break;
        case 2008:
            TestPrintd(-9234);
            TestPrintd(115641);
            TestPrintd(0);
            break;
        case 2009:
            TestPrintu(92345678);
            TestPrintu(0);
            break;
        case 2010:
            TestPrinto(92345678);
            TestPrinto(0);
            break;
        case 2011:
            TestPrintb(257);
            TestPrintb(0);
            break;
        case 2012:
            TestPrintc('c');
            break;
        case 2013:
            TestPrints("single-byte-character.");
            break;
        case 2014:
            TestPrintS(L"wide-character.");
            break;
//        case 2014:
//            Testi(-9234);
//            Testi(115641);
//            Testi(0);
//            break;
//        case 2015:
//            TestC(L'w');
//            break;
//        case 2016:
//            Testf(454613.56673f);
//            break;
//        case 2017:
//            Teste(454613.56673f);
//            break;
//        case 2018:
//            TestE(454613.56673f);
//            break;
//        case 2019:
//            Testg(454613.56673f);
//            break;
//        case 2020:
//            TestG(454613.56673f);
//            break;
//        case 2021:
//            Testnp();
//            break;
        //assert
        case 3001:
            kprintf("assert(0)\n");
            assert(0);
            break;
        case 3002:
            kprintf("assert(1)\n");
            assert(1);
            break;
        case 3003:
            kprintf("assert(-1)\n");
            assert(-1);
            break;
        case 3004:
            kprintf("assert(10)\n");
            assert(10);
            break;
        case 3005:
            kprintf("assert(-10)\n");
            assert(-10);
            break;
        case 3006:
            kprintf("assert(0xFFFFFFFF)\n");
            assert(0xFFFFFFFF);
            break;
        case 3007:
            kprintf("assert(0x7FFFFFFF)\n");
            assert(0x7FFFFFFF);
            break;
        case 3008:
            kprintf("assert(1>5)\n");
            assert(1>5);
            break;
        case 3009:
            kprintf("assert(1>=5)\n");
            assert(1>=5);
            break;
        case 3010:
            kprintf("assert(1==5)\n");
            assert(1==5);
            break;
        case 3011:
            kprintf("assert(5==5)\n");
            assert(5==5);
            break;
        case 3012:
            kprintf("assert(1<5)\n");
            assert(1<5);
            break;
        case 3013:
            kprintf("assert(1<=5)\n");
            assert(1<=5);
            break;
        case 3014:
            kprintf("assert(FALSE)\n");
            assert(FALSE);
            break;
        case 3015:
            kprintf("assert(TRUE)\n");
            assert(TRUE);
            break;
        case 3016:
            kprintf("assert(NULL)\n");
            assert(NULL);
            break;
        case 3017:
            kprintf("assert(tAssert(4))\n");
            assert(tAssert(4));
            break;
        case 3018:
            kprintf("assert(tAssert(5))\n");
            assert(tAssert(5));
            break;
        //verify
        case 4001:
            kprintf("verify(0)\n");
            verify(0);
            break;
        case 4002:
            kprintf("verify(1)\n");
            verify(1);
            break;
        case 4003:
            kprintf("verify(-1)\n");
            verify(-1);
            break;
        case 4004:
            kprintf("verify(10)\n");
            verify(10);
            break;
        case 4005:
            kprintf("verify(-10)\n");
            verify(-10);
            break;
        case 4006:
            kprintf("verify(0xFFFFFFFF)\n");
            verify(0xFFFFFFFF);
            break;
        case 4007:
            kprintf("verify(0x7FFFFFFF)\n");
            verify(0x7FFFFFFF);
            break;
        case 4008:
            kprintf("verify(1>5)\n");
            verify(1>5);
            break;
        case 4009:
            kprintf("verify(1>=5)\n");
            verify(1>=5);
            break;
        case 4010:
            kprintf("verify(1==5)\n");
            verify(1==5);
            break;
        case 4011:
            kprintf("verify(5==5)\n");
            verify(5==5);
            break;
        case 4012:
            kprintf("verify(1<5)\n");
            verify(1<5);
            break;
        case 4013:
            kprintf("verify(1<=5)\n");
            verify(1<=5);
            break;
        case 4014:
            kprintf("verify(FALSE)\n");
            verify(FALSE);
            break;
        case 4015:
            kprintf("verify(TRUE)\n");
            verify(TRUE);
            break;
        case 4016:
            kprintf("verify(NULL)\n");
            verify(NULL);
            break;
        case 4017:
            kprintf("verify(tAssert(4))\n");
            verify(tAssert(4));
            break;
        case 4018:
            kprintf("verify(tAssert(5))\n");
            verify(tAssert(5));
            break;
        case 5000:
            kprintf("Run befor DebugBreak();\n");
            DebugBreak();
            kprintf("Run after DebugBreak();\n");
        default:
            return E_NOT_IMPLEMENTED;
    }

    return NOERROR;
}

ECode Routines::TestInOutWord(IO_PORT port, uint16_t uInData)
{
    uint16_t uwData;
    Outw(port, uInData);
    uwData = Inw(port);
    kprintf("%04X ",uwData);
    if (uwData != uInData)
        return E_FAIL;
    else
        return NOERROR;
}

ECode Routines::TestInOutLong(IO_PORT port, uint32_t uInData)
{
    uint32_t ulData;
    Outl(port, uInData);
    ulData = Inl(port);
    kprintf("%08X ",ulData);
    if (ulData != uInData)
        return E_FAIL;
    else
        return NOERROR;
}

void Routines::TestPrintEscapeSequences()
{
    kprintf("Line1\r(Carriage return)\n");
    kprintf("Line2\t(Horizontal tab)\n");
    kprintf("Line3\a(Bell (alert)\n");
    kprintf("Line4\b(Backspace)\n");
    kprintf("Line5\?(Literal question mark)\n");
    kprintf("Line6\'(Single quotation mark)\n");
    kprintf("Line7\"(Double quotation mark)\n");
    kprintf("Line8\\(Backslash)\n");
    kprintf("Line9\44(ASCII character in octal notation)\n");
    kprintf("Line10\x7F(ASCII character in hexadecimal  notation)\n");
    kprintf("\n");
}
void Routines::TestPrintX(int i)
{
    kprintf("Testing      X: i=%X|\n", i);
    kprintf("width         :'3X'=%3X|'10X'=%10X|\n", i, i);
    kprintf("          '*' :'*X(*=10)'=%*X|\n", 10, i);
    kprintf("flag      '-' :'-10X'=%-10X|\n", i);
    kprintf("          '~' :'~10X'=%~10X|'~11X'=%~11X|\n", i,i);
    kprintf("          '0' :'010X'=%010X|\n", i);
    kprintf(" optional 'l' :'lX'=%lX|'10lX'=%10lX|\n", i, i);
    kprintf("\n");
}

void Routines::TestPrintx(int i)
{
    kprintf("Testing      x: i=%x|\n", i);
    kprintf("width         :'3x'=%3x|'10x'=%10x|\n", i, i);
    kprintf("          '*' :'*x(*=10)'=%*x|\n", 10, i);
    kprintf("flag      '-' :'-10x'=%-10x|\n", i);
    kprintf("          '~' :'~10x'=%~10x|'~11x'=%~11x|\n", i,i);
    kprintf("          '0' :'010x'=%010x|\n", i);
    kprintf(" optional 'l' :'lx'=%lx|'10lx'=%10lx|\n", i, i);
    kprintf("\n");
}

void Routines::TestPrintd(int i)
{
    kprintf("Testing      d: i=%d|\n", i);
    kprintf("width         :'3d'=%3d|'10d'=%10d|\n", i, i);
    kprintf("          '*' :'*d(*=10)'=%*d|\n", 10, i);
    kprintf("flag      '-' :'-10d'=%-10d|\n", i);
    kprintf("          '~' :'~10d'=%~10d|'~11d'=%~11d|\n", i,i);
    if (i >= 0)
        kprintf("          '0' :'010d'=%010d|\n", i);
    kprintf(" optional 'l' :'ld'=%ld|'10ld'=%10ld|\n", i, i);
    kprintf("\n");
}

void Routines::TestPrintu(int i)
{
    kprintf("Testing      u: i=%u|\n", i);
    kprintf("width         :'3u'=%3u|'10u'=%10u|\n", i, i);
    kprintf("          '*' :'*u(*=10)'=%*u|\n", 10, i);
    kprintf("flag      '-' :'-10u'=%-10u|\n", i);
    kprintf("          '~' :'~10u'=%~10u|'~11u'=%~11u|\n", i,i);
    kprintf("          '0' :'010u'=%010u|\n", i);
    kprintf(" optional 'l' :'lu'=%lu|'10lu'=%10lu|\n", i, i);
    kprintf("\n");
}

void Routines::TestPrinto(int i)
{
    kprintf("Testing      o: i=%o|\n", i);
    kprintf("width         :'3o'=%3o|'10o'=%10o|\n", i, i);
    kprintf("          '*' :'*o(*=10)'=%*o|\n", 10, i);
    kprintf("flag      '-' :'-10o'=%-10o|\n", i);
    kprintf("          '~' :'~10o'=%~10o|'~11o'=%~11o|\n", i,i);
    kprintf("          '0' :'010o'=%010o||\n", i);
    kprintf(" optional 'l' :'lo'=%lo|'10lo'=%10lo|\n", i, i);
    kprintf("\n");
}

void Routines::TestPrintb(int i)
{
    kprintf("Testing      b: i=%b|\n", i);
    kprintf("width         :'3b'=%3b|'10b'=%10b|\n", i, i);
    kprintf("          '*' :'*b(*=10)'=%*b|\n", 10, i);
    kprintf("flag      '-' :'-15b'=%-15b|\n", i);
    kprintf("          '~' :'~15b'=%~15b|'~16b'=%~16b|\n", i,i);
    kprintf("          '0' :'015b'=%015b|\n", i);
    kprintf(" optional 'l' :'lb'=%lb|'30lb'=%30lb|\n", i, i);
    kprintf("\n");
}

void Routines::TestPrintc(char i)
{
    kprintf("Testing      c: i=%c|\n", i);
    kprintf("width         :'3c'=%3c|'0c'=%0c|\n", i, i);
    kprintf("          '*' :'*c(*=5)'=%*c|\n", 5, i);
    kprintf("flag      '-' :'-10c'=%-10c|\n", i);
    kprintf("          '~' :'~10c'=%~10c|\n", i);
    kprintf("precision '.' :'.10c'=%.10c|'.3c'=%.3c|\n", i, i);
    kprintf("          '*' :'.*c(*=10)'=%.*c|\n", 10, i);
    kprintf("\n");
}

void Routines::TestPrints(char *i)
{
    kprintf("Testing      s: i=%s|\n", i);
    kprintf("width         :'30s'=%30s|'10s'=%10s|\n", i, i);
    kprintf("          '*' :'*s(*=5)'=%*s|\n", 5, i);
    kprintf("flag      '-' :'-30s'=%-30s|\n", i);
    kprintf("          '~' :'~30s'=%~30s|\n", i);
    kprintf("precision '.' :'.10s'=%.10s|\n", i);
    kprintf("          '*' :'.*s(*=10)'=%.*s|\n", 10, i);
    kprintf("\n");
}

void Routines::TestPrintS(wchar_t *i)
{
    kprintf("Testing      S: i=%S|\n", i);
    kprintf("width         :'30S'=%30S|'10S'=%10S|\n", i, i);
    kprintf("          '*' :'*S(*=5)'=%*S|\n", 5, i);
    kprintf("flag      '-' :'-30S'=%-30S|\n", i);
    kprintf("          '~' :'~30S'=%~30S|\n", i);
    kprintf("precision '.' :'.10S'=%.10S|\n", i);
    kprintf("          '*' :'.*S(*=10)'=%.*S|\n", 10, i);
    kprintf("\n");
}
//
//void Routines::Testi(int i)
//{
//    kprintf("Testing      i: i=%i|\n", i);
//    kprintf("width         :'3i'=%3i|'10i'=%10i|\n", i, i);
//    kprintf("flag      '-' :'-10i'=%-10i|\n", i);
//    kprintf("          '+' :'+10i'=%+10i|\n", i);
//    kprintf("          '0' :'010i'=%010i|'-010i' \
//        =%-010i|'0i'=%0i|\n", i, i, i);
//    kprintf("        blank :'_i'=% i|'+_i'=%+ i|'-_i'=%- i|\n", i, i, i);
//    kprintf("          '#' :'#i'=%#i|\n", i);
//    kprintf("precision '*' :'*i(*=10)'=%*i|\n", 10, i);
//    kprintf("          '.' :'.10i'=%.10i|'.3i'=%.3i|\n", i, i);
//    kprintf(" optional 'h' :'hi'=%hi|\n", i);
//    kprintf("          'l' :'li'=%li|\n", (long)i + 0x10000000);
//    kprintf("        'I64' :'I64i'=%I64i|\n",
//        (__int64)i + 0xEFFFFFFFF0000000ll);
//    kprintf("\n");
//}
//
//void Routines::Testf(double i)
//{
//    kprintf("Testing      f: i=%f|\n", i);
//    kprintf("width         :'10.3f'=%10.3f|'3.10f'=%3.10f|\n", i, i);
//    kprintf("flag      '-' :'-10.3f'=%-10.3f|\n", i);
//    kprintf("          '+' :'+10.3f'=%+10.3f|\n", i);
//    kprintf("          '0' :'010.3f'=%010.3f|'-010.3f'=%-010.3f|'0f'=%0f|\n",
//        i, i, i);
//    kprintf("        blank :'_f'=% f|'+_f'=%+ f|'-_f'=%- f|\n", i, i, i);
//    kprintf("          '#' :'#f'=%#f|\n", i);
//    kprintf("precision '*' :'*f(*=20.5)'=%*f|\n", 20, 5, i);
//    kprintf("          '.' :'.10f'=%.10f|'.3f'=%.3f|\n", i, i);
//    kprintf("\n");
//}
//
//void Routines::Testg(double i)
//{
//    kprintf("Testing      g: i=%g|\n", i);
//    kprintf("width         :'10.3g'=%10.3g|'3.10g'=%3.10g|\n", i, i);
//    kprintf("flag      '-' :'-10.3g'=%-10.3g|\n", i);
//    kprintf("          '+' :'+10.3g'=%+10.3g|\n", i);
//    kprintf("          '0' :'010.3g'=%010.3g|'-010.3g'=%-010.3g|'0g'=%0g|\n",
//        i, i, i);
//    kprintf("        blank :'_g'=% g|'+_g'=%+ g|'-_g'=%- g|\n", i, i, i);
//    kprintf("          '#' :'#g'=%#g|\n", i);
//    kprintf("precision '*' :'*g(*=20.5)'=%*g|\n", 20, 5, i);
//    kprintf("          '.' :'.10g'=%.10g|'.3g'=%.3g|\n", i, i);
//    kprintf("\n");
//}
//
//void Routines::TestG(double i)
//{
//    kprintf("Testing      G: i=%G|\n", i);
//    kprintf("width         :'10.3G'=%10.3G|'3.10G'=%3.10G|\n", i, i);
//    kprintf("flag      '-' :'-10.3G'=%-10.3G|\n", i);
//    kprintf("          '+' :'+10.3G'=%+10.3G|\n", i);
//    kprintf("          '0' :'010.3G'=%010.3G|'-010.3G'=%-010.3G|'0G'=%0G|\n",
//        i, i, i);
//    kprintf("        blank :'_G'=% G|'+_G'=%+ G|'-_G'=%- G|\n", i, i, i);
//    kprintf("          '#' :'#G'=%#G|\n", i);
//    kprintf("precision '*' :'*G(*=20.5)'=%*G|\n", 20, 5, i);
//    kprintf("          '.' :'.10G'=%.10G|'.3G'=%.3G|\n", i, i);
//    kprintf("\n");
//}
//
//void Routines::Teste(double i)
//{
//    kprintf("Testing      e: i=%e|\n", i);
//    kprintf("width         :'10.3e'=%10.3e|'3.10e'=%3.10e|\n", i, i);
//    kprintf("flag      '-' :'-10.3e'=%-10.3e|\n", i);
//    kprintf("          '+' :'+10.3e'=%+10.3e|\n", i);
//    kprintf("          '0' :'010.3e'=%010.3e|'-010.3e'=%-010.3e|'0e'=%0e|\n",
//        i, i, i);
//    kprintf("        blank :'_e'=% e|'+_e'=%+ e|'-_e'=%- e|\n", i, i, i);
//    kprintf("          '#' :'#e'=%#e|\n", i);
//    kprintf("precision '*' :'*e(*=20.5)'=%*e|\n", 20, 5, i);
//    kprintf("          '.' :'.10e'=%.10e|'.3e'=%.3e|\n", i, i);
//    kprintf("\n");
//}
//
//void Routines::TestE(double i)
//{
//    kprintf("Testing      E: i=%E|\n", i);
//    kprintf("width         :'10.3E'=%10.3E|'3.10E'=%3.10E|\n", i, i);
//    kprintf("flag      '-' :'-10.3E'=%-10.3E|\n", i);
//    kprintf("          '+' :'+10.3E'=%+10.3E|\n", i);
//    kprintf("          '0' :'010.3E'=%010.3E|'-010.3E'=%-010.3E|'0E'=%0E|\n",
//        i, i, i);
//    kprintf("        blank :'_E'=% E|'+_E'=%+ E|'-_E'=%- E|\n", i, i, i);
//    kprintf("          '#' :'#E'=%#E|\n", i);
//    kprintf("precision '*' :'*E(*=20.5)'=%*E|\n", 20, 5, i);
//    kprintf("          '.' :'.10E'=%.10E|'.3E'=%.3E|\n", i, i);
//    kprintf("\n");
//}
//
//void Routines::TestC(wchar_t i)
//{
//    kprintf("Testing      C: i=%C|\n", i);
//    kprintf("width         :'3C'=%3C|'0C'=%0C|\n", i, i);
//    kprintf("flag      '-' :'-10C'=%-10C|\n", i);
//    kprintf("precision '*' :'*C(*=10)'=%*C|\n", 10, i);
//    kprintf("          '.' :'.10C'=%.10C|'.3c'=%.3C|\n", i, i);
//    kprintf(" optional 'h' :'hi'=%hC|\n", i);
//    kprintf("          'l' :'li'=%lC|\n", i);
//    kprintf("\n");
//}

//void Routines::Testnp()
//{
//    int *n = (int *)0x2000000;
//    char *c = (char *)0x3000000;
//    float *f = (float *)0x4000000;
//    int ntest;
//
//    kprintf("test for %%p&%%n:%n\n", &ntest);
//    kprintf("value of ntest is %d\n", ntest);
//    kprintf("int:\t%%P:%p\nchar:\t%%p:%p\nfloat:\t%%p:%p\n", n, c, f);
//}
